Flatten JSON output for search and plans commands#6
Merged
Conversation
Embed Session/Plan structs directly in SearchResult and PlanMatch instead of nesting under a "session"/"plan" key. This makes fields like .id, .project_name, and .created accessible at the top level in jq, matching what users and agents naturally guess. Previously, 25/25 sessions using --json produced all-null output because consumers wrote .id instead of .session.id. After flattening, 4/4 test agents got field names right on the first try. Also adds JSON field list and jq example to search --help. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
session/plankey.id,.project_name, and.createdare now accessible at the top level in jqsearch --helpMotivation
With the nested format, agents and users guessing field names wrote
.idinstead of.session.id, producing silent all-null output from jq. Tested with multiple agents — flattened format achieved 100% first-try success vs 0% with the nested format.Test plan
just cipasses (fmt-check, lint, test)search --jsonoutput has top-level fields via jq key inspectionlist --jsonandsearch --jsonfield names are consistent🤖 Generated with Claude Code